var login = {
	init : function() {
		login.loginForm = $('#loginForm');
	},
	doLogin : function() {
		$.messager.progress({
			text : '正在处理...'
		});
		login.loginForm.form('submit', {
			 url: window.ctx + '/test/TestServlet?command=login',
			 onSubmit: function(){
			 var isValid = $(this).form('validate');
			 if (!isValid){
			 $.messager.progress('close');
			 }
			 return isValid;
			 },
			 success: function(data){
			 $.messager.progress('close');
			 console.info(data);
			 if (data=='2') {
				 $.messager.alert('警告', "账号和密码输入错误，请重新输入！！！", 'error');
			 }
			 if (data=='1') {
			 location = window.ctx + '/view/common/main.jsp';
			 }
			 }
		});
	}
};

$(function() {
	login.init();
});